home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-01-05 | 9.9 KB | 258 lines | [TEXT/ALFA] |
-
-
- Forth2LaTeX User's Manual
-
-
- by
- Ronald T. Kneusel
- January 1995
-
- ver 1.9
-
-
-
- Copyright
- ---------
-
- This manual and the program it describes, along with all source files, is
- (c) 1994, by Ronald T. Kneusel. All rights reserved. Non-profit distribution
- permitted as long as this manual is included and all copyright notices remain
- intact. Please inform me of any changes you make to at the email address below.
-
- Ronald T. Kneusel
- 8725 West Burdick Avenue
- Milwaukee, WI 53227 USA
- (414) 545-7557
-
- Internet: kneusel@studsys.mscs.mu.edu
-
-
- What is it?
- -----------
-
- Forth2LaTeX is a program designed to format Forth source code for LaTeX. It
- presently runs in Modula-2 and C on the Macintosh and in C on Unix, VMS, and
- MS-DOS. This manual describes all versions noting differences where appropriate.
- Source code for both the C and Modula-2 versions is included for those
- interested in modifying the program to suit their own needs. Forth2LaTeX
- intentionally knows little of Forth. It knows what a \ comment is and the
- words : (colon), VARIABLE, CONSTANT, CREATE, FVARIABLE, and FCONSTANT.
- This does not tie it to a specific Forth system making Forth2LaTeX useful to
- the widest possible audience.
-
- Forth2LaTeX features include:
-
- * Ability to bold word names when defined.
-
- * Creating an index of defined words and the line on which the word was
- defined.
-
- * Printing useful program information.
-
- * Complete LaTeX access from within the source code in three different ways.
-
- * Different type styles for code and comments.
-
- * Ability to create a table of contents and section the code in a way
- similar to LaTeX.
-
- * Command files allow processing groups of files at a single time.
-
- Forth2LaTeX does impose one minor constraint on the programmer, namely, it
- only recognizes \ comments and therefore will treat comments in
- parentheses as code. This is really a minor inconvenience as parentheses
- are usually reserved for stack effects comments.
-
-
- Getting Started - A Guide for the Impatient
- -------------------------------------------
-
- If your copious free time is insufficient to allow a complete reading of
- this little manual, this is a good place to start. The guide is divided
- by computer: Macintosh or Everyone Else.
-
- ** Macintosh **
-
- Double-click the Forth2LaTeX application to get it going. All parameters can
- be set via the SETTINGS menu. Just choose the setting and it toggles
- between on or off. Switching between REPORT and ARTICLE for the style
- will use the respective LaTeX document style. Typically, longer programs
- make sense as reports while shorter programs are articles. Chapter
- sectioning may only be used (or rather is ignored unless) the style is set
- to REPORT. Leave the COMMENTS as FORTH unless you have included LaTeX code
- in the comments and did not use the ` (backquote) escape character.
-
- Choose OPEN... from the FILE menu and select a Forth source code file. If
- the filename ends in .4th, .fth, or .forth the extension will be stripped.
- Select an output filename using either the one suggested or your own with
- .tex appended. Forth2LaTeX will process the file and report how many lines
- were processed when finished.
-
- ** Everyone Else **
-
- Enter 'Forth2LaTeX' on the command line to see a quick help screen listing
- the format and switches. Most a self-explanatory in nature, the rest are
- described below.
-
-
- Controlling Forth2LaTeX
- -----------------------
-
- There are two ways of controlling the operation of Forth2LaTeX: via menu or
- command line switches, or via Forth comments within the source code.
- The latter will always override the former. Needless to say, only the
- Macintosh version uses menus, the rest use command line switches.
-
- ** Source Code **
-
- All versions of Forth2LaTeX can be controlled by comment statements within the
- Forth source code. It is important to note that spacing and capitalization
- _are_ important.
-
- *** Settings ***
-
- Forth2LaTeX settings and information about the program are entered in the
- following form:
-
- \ Program: <program name> -- name of the program
- \ Author: <author name> -- name of the author, appears in the title
- \ Started: <date> -- date program begun
- \ Modified: <date> -- date of last modification
- \ Modify By: <name> -- person doing the modification
- \ Summary: <single line> -- a one line summary of the program
-
- \ Comments: FORTH -- comments are as normal
- \ Comments: LATEX -- comments are treated as LaTeX code
-
- \ Uppercase: ON or OFF -- force all but strings and comments to
- uppercase
-
- \ Table of Contents: ON | OFF -- make a table of contents, use with
- sectioning
-
- \ Index: ON | OFF -- output an alphabetical index of defined words
-
- \ Bold: ON | OFF -- bold colon definitions
-
- \ Style: REPORT -- use \documentstyle{report}
- \ Style: ARTICLE -- use \documentstyle{article}
-
-
- Certain characters have a special meaning to LaTeX and need to be escaped
- by prefixing with a \ when use normally. Forth2LaTeX does this automatically
- for code, including the spaces to force LaTeX to preserve the indentations,
- but can be told to stop this for comments. The default setting is FORTH
- which escapes the text in comments as elsewhere. Changing COMMENTS to LATEX
- allows the programmer to include LaTeX code in the comments, but also makes
- the programmer responsible for using appropriate escape sequences when
- necessary. Note that the settings above can appear anywhere within the source
- code, but must appear in the first file to be processed when using multiple
- files.
-
- *** Sectioning ***
-
- Forth2LaTeX recognizes the standard LaTeX sectioning commands, though it
- ignores chapters unless in REPORT style. Sectioning provides a convenient
- way to organize the source code and to create a table of contents that
- outlines the program structure. To use sectioning, include statements
- giving the name of the section prefixed by the type of section:
-
- \ Chapter: <chapter-name> -- start a chapter (LaTeX \chapter)
-
- \ Section: -- sections and subsections
- \ Subsection:
- \ Subsubsection:
-
-
- *** Other Ways of Including LaTeX Code ***
-
- The Comments: setting described above is only one of three ways to include
- LaTeX code in the Forth source code. The others are to use a special LaTeX
- escape character or to use a \ . to prefix a line that will be passed as is
- into the output file. The former is most useful for inserting a small piece
- of code:
-
- \ `$c_{m}$` is set here
-
- appears as: $\backslash$\ \ $c_{m}$ is set here
-
- The escape character is ` (backquote). Everything between backquotes is
- immune to special character escaping and can include valid LaTeX statements.
-
- To include an entire line, useful for entering normal text, prefix the
- line with a \ . where every character after the period is sent as is into
- the output file without escaping or forcing into a single line:
-
- \ .This will appear in the output as if it were entered into a normal
- \ .LaTeX document. This could be used to insert large blocks of text
- \ .describing the code, or to even include graphics.
-
-
- ** Command Line Switches and Menu Settings **
-
- It is possible change Forth2LaTeX settings without specifically stating the
- settings in the source code. The Macintosh uses a menu called (surprisingly)
- SETTINGS to adjust Forth2LaTeX values prior to processing a file. Each of the
- menu items has a direct counter part in the source code settings given above.
-
- Other computers use command line switches to alter the functioning of
- Forth2LaTeX. The general format is:
-
- Forth2LaTeX <source-file> <switches>
-
- where the <switches> consists of a string of characters (case is irrelevant)
- prefixed with a - (dash). No switches need be specified. The options are
- listed below:
-
- u -- uppercase code (does not alter comments)
- l -- comments LATEX (default is FORTH)
- t -- generate table of contents
- i -- index of defined words
- b -- bold colon definition names
- r -- style is REPORT (default is ARTICLE)
-
-
- ** Multiple Files **
-
- If Forth2LaTeX is presented a file with a .f2l extension it will assume it to
- be a command file that contains the names of a series of files to be processed.
- Comments, preceeded by a # character, may be added to the file.
- A sample command file could be:
-
- # The following specifies the output file name, default is 'a.tex'
-
- # Output: Alexis.tex
-
- # These are the files to be processed, in order:
-
- Setup.4th # mainly memory management, constants, etc.
- Arith.4th # big integer and rational arithmetic and utilities
- Poly.4th # univariate polynomial routines and utilities
- Command.4th # Yerk code and command processor
- Intrinsic.4th # Built-in commands
-
- # That's all folks!
-
-
- The third line above is used to specify the output file name, which
- defaults to a.tex. Unless complete path names are given in the
- command file Forth2LaTeX assumes that the files can be found in the current
- directory. Use a command file when working on a larger project with
- multiple files.
-
-
- Conclusion
- ----------
-
- It is sincerely hoped that Forth2LaTeX will be of use to you. It is also hoped
- that users will feel free to alter the source code for any of the versions,
- provided that the author is sent a copy if the modified version is to be
- released publicly.
-
- Suggestions and bug reports (Bugs? What are those?) are to be sent to the
- email address given at the beginning of this document. The author assumes no
- responsibility of any kind for any loss of data or time that may be
- caused by the use of this program. While it is unlikely that something
- will happen, if it does, I'm not to blame.
-
-